package com.xuecheng.base.exception;

public class XueChengPlusException extends RuntimeException{
    private String errMessage;

    private String errCode;

    public XueChengPlusException(){
    }

    public XueChengPlusException(String message){
        super(message);
        this.errMessage = message;
    }

    public XueChengPlusException(String errCode,String message){
        super(message);
        this.errMessage = message;
        this.errCode = errCode;
    }

    public String getErrCode() {
        return errCode;
    }

    public void setErrCode(String errCode) {
        this.errCode = errCode;
    }

    public String getErrMessage() {
        return errMessage;
    }

    public void setErrMessage(String errMessage) {
        this.errMessage = errMessage;
    }

    public static void cast(String message){
        throw new XueChengPlusException(message);
    }

    public static void cast(String code,String message){
        throw new XueChengPlusException(code,message);
    }

    public static void cast(CommonError error){
        throw new XueChengPlusException(error.getErrMessage());
    }
}
